package cn.com.gzheroli.bfw.web.system.controler.core;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.ibatis.jdbc.SQL;
import org.apache.log4j.Logger;

import cn.com.gzheroli.auth.service.TSDataruleService;
import cn.com.gzheroli.bfw.pojo.base.TSFunction;
import cn.com.gzheroli.bfw.pojo.base.TSRole;
import cn.com.gzheroli.bfw.pojo.base.TSRoleFunction;
import cn.com.gzheroli.bfw.pojo.base.TSRoleUser;
import cn.com.gzheroli.bfw.pojo.base.TSUser;
import cn.com.gzheroli.cache.SpringRedisCache;
import cn.com.gzheroli.core.common.controller.BaseController;
import cn.com.gzheroli.core.common.model.json.AjaxJson;
import cn.com.gzheroli.core.common.model.json.ComboTree;
import cn.com.gzheroli.core.common.model.json.TreeGrid;
import cn.com.gzheroli.core.common.model.json.ValidForm;
import cn.com.gzheroli.core.common.service.CommonService;
import cn.com.gzheroli.core.common.service.SystemService;
import cn.com.gzheroli.core.constant.Globals;
import cn.com.gzheroli.core.manager.Client;
import cn.com.gzheroli.core.util.IdWorker;
import cn.com.gzheroli.core.util.LogUtil;
import cn.com.gzheroli.core.util.SetListSort;
import cn.com.gzheroli.core.util.StringUtil;
import cn.com.gzheroli.core.util.UUIDGenerator;
import cn.com.gzheroli.core.util.oConvertUtils;
import cn.com.gzheroli.rabbitmq.service.log.LogService;
import cn.com.gzheroli.service.bfw.FunctionService;
import cn.com.gzheroli.service.bfw.RoleService;
import cn.com.gzheroli.service.bfw.UserService;
import cn.com.gzheroli.tag.core.DataGrid;
import cn.com.gzheroli.tag.vo.easyui.TreeGridModel;
import cn.com.gzheroli.util.TagUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * 角色处理类
 *
 * 
 */
@Controller
@RequestMapping("/roleController")
public class RoleController extends BaseController {
	private static final Logger logger = Logger.getLogger(RoleController.class);
	@Autowired
	private UserService userService;
	@Autowired
	private SystemService systemService;
	@Autowired
	private RoleService roleService;	
	@Autowired
	private FunctionService functionService;
	@Autowired
	private CommonService commonService;
	
	@Autowired
	private LogService logService;
	@Autowired
    private SpringRedisCache cache;
	@Autowired
	  private TSDataruleService dataruleService;
	private String message = null;

	/**
	 * easyuiAJAX请求数据
	 * 
	 * @param request
	 * @param response
	 * @param dataGrid
	 * @param user
	 */

	@RequestMapping(params = "roleGrid")
	public void roleGrid(TSRole role, HttpServletRequest request,
			HttpServletResponse response, DataGrid dataGrid) {
		String token = request.getHeader("token")==null?request.getParameter("token"):request.getHeader("token");
		Client client=cache.getCache(token, Client.class);
		if(client==null||client.getUser()==null){
			dataGrid.setTotal(0);
			dataGrid.setResults(new ArrayList());
			TagUtil.datagrid(response, dataGrid);
			return;
		}
		TSUser user=client.getUser();
		Map datamap=new HashMap();
	 	Integer page = Integer.valueOf(Integer.parseInt(request.getParameter("page")));
	    Integer rows = Integer.valueOf(Integer.parseInt(request.getParameter("rows")));
	    Integer start = Integer.valueOf((page.intValue() - 1) * rows.intValue())+1;
	    Integer end = Integer.valueOf(page.intValue() * rows.intValue() );
		datamap.put("maxResults", end.intValue());
		datamap.put("firstResult", start.intValue());
		datamap.put("pageSize", rows);
		datamap.put("beginRow", (page-1)*rows);//mysql
		datamap.put("rolename", request.getParameter("roleName"));
		datamap.put("roleCode", request.getParameter("roleCode"));
		//String authSql=dataruleService.genSqlByModuleName("authUserSql","bu",user);	
		//datamap.put("authSql", authSql);
		List<Map> data=roleService.getRoles(datamap);
		Long Acount=roleService.getRolesAcount(datamap);
		dataGrid.setResults(data);
		dataGrid.setTotal(Acount.intValue());
		TagUtil.datagrid(response, dataGrid);//把数据通过标签返回
	}

	/**
	 * 删除角色
	 * 
	 * @param ids
	 * @return
	 */
	@RequestMapping(params = "delRole")
	@ResponseBody
	public AjaxJson delRole(TSRole role, HttpServletRequest request) {
		AjaxJson j = new AjaxJson();
		int count = userService.getUsersOfThisRole(role.getId());
		if (count == 0) {
			// 删除角色之前先删除角色权限关系
			delRoleFunction(role);
			//role = systemService.getEntity(TSRole.class, role.getId());
			commonService.delete(TSRole.class, role.getId());
			message = "角色: " + role.getRoleName() + "被删除成功";
			logService.addLogRoleauth(message, Globals.Log_Type_DEL,null, LogUtil.logReqMap(request));
		} else {
			message = "角色: 仍被用户使用，请先删除关联关系";
		}
		j.setMsg(message);
		return j;
	}

	/**
	 * 检查角色
	 * 
	 * @param ids
	 * @return
	 */
	@RequestMapping(params = "checkRole")
	@ResponseBody
	public ValidForm checkRole(TSRole role, HttpServletRequest request,
			HttpServletResponse response) {
		ValidForm v = new ValidForm();
		String roleCode = oConvertUtils
				.getString(request.getParameter("param"));
		String code = oConvertUtils.getString(request.getParameter("code"));
		List<TSRole> roles = commonService.findByProperty(TSRole.class,
				"roleCode", roleCode);
		if (roles.size() > 0 && !code.equals(roleCode)) {
			v.setInfo("角色编码已存在");
			v.setStatus("n");
		}
		return v;
	}

	/**
	 * 删除角色权限
	 * 
	 * @param role
	 */
	protected void delRoleFunction(TSRole role) {
		List<TSRoleFunction> roleFunctions = commonService.findByProperty(
				TSRoleFunction.class, "roleId", role.getId());
		if (roleFunctions.size() > 0) {
			for (TSRoleFunction tsRoleFunction : roleFunctions) {
				commonService.delete(TSRoleFunction.class,tsRoleFunction.getId());
			}
		}
		List<TSRoleUser> roleUsers = commonService.findByProperty(
				TSRoleUser.class, "roleId", role.getId());
		for (TSRoleUser tsRoleUser : roleUsers) {
			commonService.delete(TSRoleUser.class,tsRoleUser.getId());
		}
	}

	/**
	 * 角色录入
	 * 
	 * @param ids
	 * @return
	 */
	@RequestMapping(params = "saveRole")
	@ResponseBody
	public AjaxJson saveRole(TSRole role, HttpServletRequest request) {
		AjaxJson j = new AjaxJson();
		if (StringUtil.isNotEmpty(role.getId())) {
			message = "角色: " + role.getRoleName() + "被更新成功";
			commonService.update(role);
			logService.addLogRoleauth(message, Globals.Log_Type_UPDATE,null, LogUtil.logReqMap(request));
		} else {
			message = "角色: " + role.getRoleName() + "被添加成功";
			role.setId(IdWorker.getFlowIdWorkerInstance().nextIdStr());
			commonService.save(role);
			logService.addLogRoleauth(message, Globals.Log_Type_INSERT,null, LogUtil.logReqMap(request));
		}

		return j;
	}

	/**
	 * 角色列表页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "fun")
	public ModelAndView fun(HttpServletRequest request) {
		String roleId = request.getParameter("roleId");
		request.setAttribute("roleId", roleId);
		return new ModelAndView("system/role/roleSet");
	}



	/**
	 * 权限比较
	 * 
	 * @param set
	 *            最新的权限列表
	 * @param role
	 *            当前角色
	 * @param map
	 *            旧的权限列表
	 * @param entitys
	 *            最后保存的权限列表
	 */
	private void updateCompare(Set<String> set, TSRole role,
			Map<String, TSRoleFunction> map) {
		List<TSRoleFunction> entitys = new ArrayList<TSRoleFunction>();
		List<TSRoleFunction> deleteEntitys = new ArrayList<TSRoleFunction>();
		for (String s : set) {
			if (map.containsKey(s)) {
				map.remove(s);
			} else {
				TSRoleFunction rf = new TSRoleFunction();
				TSFunction f = this.commonService.get(TSFunction.class, s);
				/*rf.setTSFunction(f);
				rf.setTSRole(role);*/
				rf.setFunctionId(f.getId());
				rf.setRoleId(role.getId());
				entitys.add(rf);
			}
		}
		Collection<TSRoleFunction> collection = map.values();
		Iterator<TSRoleFunction> it = collection.iterator();
		for (; it.hasNext();) {
			TSRoleFunction rfBean=it.next();
			deleteEntitys.add(rfBean);
			commonService.delete(TSRoleFunction.class, rfBean.getId());
		}
		//systemService.batchSave(entitys);
		commonService.batchInsert(TSRoleFunction.class, entitys);
		//systemService.deleteAllEntitie(deleteEntitys);

	}

	/**
	 * 角色页面跳转
	 * 
	 * @param role
	 * @param req
	 * @return
	 */
	@RequestMapping(params = "addorupdate")
	public ModelAndView addorupdate(TSRole role, HttpServletRequest req) {
		if (role.getId() != null) {
			role = commonService.getEntity(TSRole.class, role.getId());
			req.setAttribute("role", role);
		}
		return new ModelAndView("system/role/role");
	}
	/**
	 * 获取角色信息
	 * 
	 * @return
	 */
	@RequestMapping(params = "getRoleData")
	@ResponseBody
	public AjaxJson getRoleData(TSRole role,HttpServletRequest request) {
		AjaxJson j=new AjaxJson();
		if (role.getId() != null) {
			role = commonService.getEntity(TSRole.class, role.getId());
		}
		j.setObj(role);
		j.setSuccess(true);
		j.setMsg("获取成功");
		return j;
	}
	/**
	 * 权限操作列表
	 * 
	 * @param role
	 * @param request
	 * @param response
	 * @param dataGrid
	 * @param user
	 * @return
	 */
	@RequestMapping(params = "setOperate")
	@ResponseBody
	public List<TreeGrid> setOperate(HttpServletRequest request,
			TreeGrid treegrid) {
		String roleId = request.getParameter("roleId");
		String token = request.getHeader("token")==null?request.getParameter("token"):request.getHeader("token");
		Client client=cache.getCache(token, Client.class);
		if(client==null||client.getUser()==null){
			return new ArrayList();
		}
		TSUser user=client.getUser();
		
		return roleService.getOperate(treegrid, roleId, user);
	}

	/**
	 * 操作录入
	 * 
	 * @param ids
	 * @return
	 */
	@RequestMapping(params = "saveOperate")
	@ResponseBody
	public AjaxJson saveOperate(HttpServletRequest request) {
		AjaxJson j = new AjaxJson();
		String fop = request.getParameter("fp");
		String roleId = request.getParameter("roleId");
		// 录入操作前清空上一次的操作数据
		clearp(roleId);
		String[] fun_op = fop.split(",");
		String aa = "";
		String bb = "";
		// 只有一个被选中
		if (fun_op.length == 1) {
			bb = fun_op[0].split("_")[1];
			aa = fun_op[0].split("_")[0];
			savep(roleId, bb, aa);
		} else {
			// 至少2个被选中
			for (int i = 0; i < fun_op.length; i++) {
				String cc = fun_op[i].split("_")[0]; // 操作id
				if (i > 0 && bb.equals(fun_op[i].split("_")[1])) {
					aa += "," + cc;
					if (i == (fun_op.length - 1)) {
						savep(roleId, bb, aa);
					}
				} else if (i > 0) {
					savep(roleId, bb, aa);
					aa = fun_op[i].split("_")[0]; // 操作ID
					if (i == (fun_op.length - 1)) {
						bb = fun_op[i].split("_")[1]; // 权限id
						savep(roleId, bb, aa);
					}

				} else {
					aa = fun_op[i].split("_")[0]; // 操作ID
				}
				bb = fun_op[i].split("_")[1]; // 权限id

			}
		}

		return j;
	}

	/**
	 * 更新操作
	 * 
	 * @param roleId
	 * @param functionid
	 * @param ids
	 */
	public void savep(String roleId, String functionId, String ids) {
		roleService.savep(roleId, functionId, ids);
	}

	/**
	 * 清空操作
	 * 
	 * @param roleId
	 */
	public void clearp(String roleId) {
		List<TSRoleFunction> rFunctions = commonService.findByProperty(
				TSRoleFunction.class, "roleId", roleId);
		if (rFunctions.size() > 0) {
			for (TSRoleFunction tRoleFunction : rFunctions) {
				tRoleFunction.setOperation(null);
				commonService.update(tRoleFunction);
			}
		}
	}

	/**
	 * 按钮权限展示
	 * 
	 * @param request
	 * @param functionId
	 * @param roleId
	 * @return
	 */
	@RequestMapping(params = "operationListForFunction")
	public ModelAndView operationListForFunction(HttpServletRequest request,
			String functionId, String roleId) {
		/*CriteriaQuery cq = new CriteriaQuery(TSOperation.class);
		cq.eq("TSFunction.id", functionId);
		cq.add();
		List<TSOperation> operationList = this.systemService
				.getListByCriteriaQuery(cq, false);*/
		Map dataMap=new HashMap();
		dataMap.put("functionId", functionId);
		List<Map<String,Object>> operationList=roleService.getOperationList(dataMap);
		Set<String> operationCodes = systemService
				.getOperationCodesByRoleIdAndFunctionId(roleId, functionId);
		request.setAttribute("operationList", operationList);
		request.setAttribute("operationcodes", operationCodes);
		request.setAttribute("functionId", functionId);
		return new ModelAndView("system/role/operationListForFunction");
	}
	/**
	 * 按钮操作权限展示
	 * 
	 * @return
	 */
	@RequestMapping(params = "getOperationListForFunction")
	@ResponseBody
	public AjaxJson getOperationListForFunction(HttpServletRequest request,String functionId, String roleId) {
		AjaxJson j=new AjaxJson();
		String token = request.getHeader("token")==null?request.getParameter("token"):request.getHeader("token");
		Client client=cache.getCache(token, Client.class);
		if(client==null||client.getUser()==null){
			j.setSuccess(false);
			j.setMsg("尚未登录,请登录!");
			return j;
		}
		TSUser user=client.getUser();
		j=roleService.getOperationListForFunction(user, functionId, roleId);
		return j;
	}

	/**
	 * 更新按钮权限
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping(params = "updateOperation")
	@ResponseBody
	public AjaxJson updateOperation(HttpServletRequest request) {
		
		String roleId = request.getParameter("roleId");
		String functionId = request.getParameter("functionId");
		String operationcodes = request.getParameter("operationcodes");
		AjaxJson j =roleService.updateOperation(roleId, functionId, operationcodes);
		return j;
	}

	// ----
	/**
	 * 方法描述: 查看成员列表 作 者： yiming.zhang 日 期： Dec 4, 2013-8:53:39 PM
	 * 
	 * @param request
	 * @param departid
	 * @return 返回类型： ModelAndView
	 */
	@RequestMapping(params = "userList")
	public ModelAndView userList(TSRole role, HttpServletRequest request) {
		request.setAttribute("role", role);
		return new ModelAndView("system/role/roleUserList");
	}

	/**
	 * 方法描述: 角色内成员列表
	 */
	@RequestMapping(params = "userDatagrInid")
	public void userDatagrInid(HttpServletRequest request,
			HttpServletResponse response, DataGrid dataGrid) {
		String token = request.getHeader("token")==null?request.getParameter("token"):request.getHeader("token");
		Client client=cache.getCache(token, Client.class);
		if(client==null||client.getUser()==null){
			dataGrid.setTotal(0);
			dataGrid.setResults(new ArrayList());
			TagUtil.datagrid(response, dataGrid);
			return;
		}
		TSUser user=client.getUser();
		String roleid = oConvertUtils.getString(request.getParameter("roleid"));
		String userName = oConvertUtils.getString(request.getParameter("userName"));
		String realName = oConvertUtils.getString(request.getParameter("realName"));
		Map para=new HashMap();
		Integer page = Integer.valueOf(Integer.parseInt(request.getParameter("page")));
	    Integer rows = Integer.valueOf(Integer.parseInt(request.getParameter("rows")));
	    Integer start = Integer.valueOf((page.intValue() - 1) * rows.intValue())+1;
	    Integer end = Integer.valueOf(page.intValue() * rows.intValue() );
	    para.put("maxResults", end.intValue());
	    para.put("firstResult", start.intValue());
	    para.put("pageSize", rows);
	    para.put("beginRow", (page-1)*rows);//mysql
		para.put("roleID", roleid);
		para.put("userName", userName);
		para.put("realName", realName);
		//String authSql=dataruleService.genSqlByModuleName("authUserSql","bu",user);	
		//para.put("authSql", authSql);
		List users=userService.getUserList(para);
		dataGrid.setResults(users);
		int total=userService.getUserCount(para).intValue();
		dataGrid.setTotal(total);
		TagUtil.datagrid(response, dataGrid);
	}

	/**
	 * 方法描述: 角色外成员
	 */
	@RequestMapping(params = "userDatagrOutid")
	public void userDatagrOutid(HttpServletRequest request,
			HttpServletResponse response, DataGrid dataGrid) {
		String roleid = oConvertUtils.getString(request.getParameter("roleid"));
		String userName = oConvertUtils.getString(request.getParameter("userName"));
		String realName = oConvertUtils.getString(request.getParameter("realName"));
		String token = request.getHeader("token")==null?request.getParameter("token"):request.getHeader("token");
		Client client=cache.getCache(token, Client.class);
		if(client==null||client.getUser()==null){
			dataGrid.setTotal(0);
			dataGrid.setResults(new ArrayList());
			TagUtil.datagrid(response, dataGrid);
			return;
		}
		TSUser user=client.getUser();
		Map para=new HashMap();
		Integer page = Integer.valueOf(Integer.parseInt(request.getParameter("page")));
	    Integer rows = Integer.valueOf(Integer.parseInt(request.getParameter("rows")));
	    Integer start = Integer.valueOf((page.intValue() - 1) * rows.intValue())+1;
	    Integer end = Integer.valueOf(page.intValue() * rows.intValue() );
	    para.put("maxResults", end.intValue());
	    para.put("firstResult", start.intValue());
	    para.put("pageSize", rows);
	    para.put("beginRow", (page-1)*rows);//mysql
		para.put("notRoleID", roleid);
		para.put("userName", userName);
		para.put("realName", realName);
		//String authSql=dataruleService.genSqlByModuleName("authUserSql","bu",user);	
		//para.put("authSql", authSql);
		List users=userService.getUserList(para);
		dataGrid.setResults(users);
		int total=userService.getUserCount(para).intValue();
		dataGrid.setTotal(total);
		TagUtil.datagrid(response, dataGrid);
	}

	/**
	 * 删除角色用户
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping(params = "deleteRoleUser")
	@ResponseBody
	public AjaxJson deleteRoleUser(HttpServletRequest request) {
		String roleId = request.getParameter("roleid");
		String userids = request.getParameter("ids");
		AjaxJson j=roleService.deleteRoleUser( roleId, userids);
		return j;
	}

	/**
	 * 添加角色用户
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping(params = "addRoleUser")
	@ResponseBody
	public AjaxJson addRoleUser(HttpServletRequest request) {
		AjaxJson j = new AjaxJson();
		String roleId = request.getParameter("roleid");
		String userids = request.getParameter("ids");
		String[] ids = userids.split(",");
		//String sql = "insert into T_S_ROLE_USER(id,roleid,userid)  values(?,?,?)";
		for (String userId : ids) {
			TSRoleUser ru=new TSRoleUser();
			ru.setRoleId(roleId);
			ru.setUserId(userId);
			ru.setId(IdWorker.getFlowIdWorkerInstance().nextIdStr());
			commonService.save(ru);
			/*String uuid = UUIDGenerator.generate();
			systemService.executeSql(sql, uuid, roleId, userId);*/
		}
		j.setMsg("添加角色用户成功");
		return j;
	}
	
	/*
	 * *****************角色管理操作****************************
	 */
	/**
	 * 角色列表页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "role")
	public ModelAndView role() {
		return new ModelAndView("system/role/roleList");
	}

	/**
	 * easyuiAJAX请求数据
	 * 
	 * @param request
	 * @param response
	 * @param dataGrid
	 * @param user
	 */

	@RequestMapping(params = "datagridRole")
	public void datagridRole(HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
		String token = request.getHeader("token")==null?request.getParameter("token"):request.getHeader("token");
		Client client=cache.getCache(token, Client.class);
		if(client==null||client.getUser()==null){
			dataGrid.setTotal(0);
			dataGrid.setResults(new ArrayList());
			TagUtil.datagrid(response, dataGrid);
			return;
		}
		TSUser user=client.getUser();
		Map dataMap=new HashMap();
		//String authSql=dataruleService.genSqlByModuleName("authUserSql","bu",user);	
		//dataMap.put("authSql", authSql);
		List roleList=roleService.getRoles(dataMap);
		int total=roleService.getRolesAcount(dataMap).intValue();
		dataGrid.setResults(roleList);
		dataGrid.setTotal(total);
		TagUtil.datagrid(response, dataGrid);
	}

	



	/**
	 * 设置权限
	 * 
	 * @param role
	 * @param request
	 * @param response
	 * @param dataGrid
	 * @param user
	 * @return
	 */
	@RequestMapping(params = "setAuthority")
	@ResponseBody
	public List<ComboTree> setAuthority(TSRole role, HttpServletRequest request, ComboTree comboTree) {
		String token = request.getHeader("token")==null?request.getParameter("token"):request.getHeader("token");
		Client client=cache.getCache(token, Client.class);
		if(client==null||client.getUser()==null){
			return new ArrayList();
		}
		TSUser user=client.getUser();
		Map dataMap=new HashMap();
		if (comboTree.getId() != null) {
			dataMap.put("pid", oConvertUtils.getInt(comboTree.getId(), 0));
		}
		if (comboTree.getId() == null) {
			dataMap.put("pid", null);
		}
		if (request.getParameter("roleId") != null) {
			dataMap.put("roleId", request.getParameter("roleId"));
		}
		//String authSql=dataruleService.genSqlByModuleName("authUserSql","bu",user);	
		//dataMap.put("authSql", authSql);
		//return roleService.getAllRoleFunctionList(dataMap);
		return roleService.getAllAuthorityList(dataMap);
	}

	/**
	 * 更新权限
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping(params = "updateAuthority")
	@ResponseBody
	public AjaxJson updateAuthority(HttpServletRequest request) {
		String operations=request.getParameter("operations");
		String roleId = oConvertUtils.getString(request.getParameter("roleId"), "");
		String rolefunction = request.getParameter("rolefunctions");
		AjaxJson j=roleService.updateAuthority( operations, roleId, rolefunction);
		return j;
	}

	/**
	 * 角色页面跳转
	 * 
	 * @param role
	 * @param req
	 * @return
	 */
	@RequestMapping(params = "addorupdateRole")
	public ModelAndView addorupdateRole(TSRole role, HttpServletRequest req) {
		if (role.getId() != null) {
			role = commonService.getEntity(TSRole.class, role.getId());
			req.setAttribute("role", role);
		}
		return new ModelAndView("system/role/role");
	}

	/**
	 * 操作列表页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "operate")
	public ModelAndView operate(HttpServletRequest request) {
		String roleid = request.getParameter("roleid");
		request.setAttribute("roleid", roleid);
		return new ModelAndView("system/role/functionList");
	}


}
